window.onload = function(){
	
	var  box1 = document.getElementsByClassName('box1')

	var  btn = document.getElementById('btn')

	var a = 0 ;

	var arr=[0,1,2,4,7,6,5,3 ]

	function run(){
		for (var i = 0; i < box1.length; i++) {
			box1[i].style.borderColor='yellow'
		};
		box1[a].style.borderColor='red';

		a++

		if (a==box1.length) {
			a=0
		};
	}
	
	var b = 1

	btn.onclick = function(){
		if (b==1) {
			
			time = setInterval(run, 200);
			
			btn.value='停止';
			
			b=0;

		}else{
			
			clearInterval(time);

			btn.value='开始';

			b=1;
		};

	}


}